@layout("../layout/base.html",{title:"支付宝-交易关闭"},"__CONTENT__"){
<form class="form-horizontal" id="myForm">
    <div class="form-group">
        <label for="outTradeNo" class="col-sm-2 control-label">原商户订单号</label>
        <div class="col-sm-8">
            <input class="form-control" id="outTradeNo" name="outTradeNo"
                   placeholder="原商户订单号">
        </div>
    </div>
    <div class="form-group">
        <label for="tradeNo" class="col-sm-2 control-label">支付宝交易号</label>
        <div class="col-sm-8">
            <input class="form-control" id="tradeNo" name="tradeNo"
                   placeholder="支付宝交易号">
        </div>
    </div>
    <div class="form-group">
        <label for="notifyUrl" class="col-sm-2 control-label">异步通知地址</label>
        <div class="col-sm-8">
            <input class="form-control" id="notifyUrl" name="notifyUrl"
                   value="${notifyUrl!}"
                   placeholder="异步通知地址">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
            <button type="button" class="btn btn-default btn-block" id="doRefund">确认关闭</button>
        </div>
    </div>
</form>
<script>
    $("#getOrderNo").on("click", function () {
        $.post('/common/order/getOrderNo', {}, function (resp) {
            $("input[name='outRequestNo']").val(resp);
        });
    });

    $("#doRefund").on("click", function () {
        var data = $("#myForm").serializeArray();
        $.post("/alipay/close/doClose", data, function (resp) {
            if (resp.code === "200") {
                alert("操作成功");
                window.location.reload();
            } else {
                alert(resp.data);
            }
        });
    });
</script>
@}